import { ServicesModule } from './../services/services.module';
import { NgModule, Optional, SkipSelf } from '@angular/core';
import { HeaderComponent } from './header/header.component';
import { FooterComponent } from './footer/footer.component';
import { SidebarComponent } from './sidebar/sidebar.component';
import { DomSanitizer } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import 'rxjs/add/operator/take';

import {loadSvgRegsources} from "../utils/svg.util";
import {MatIconRegistry} from "@angular/material";
// 共享模块
import { SharedModule } from "../shared/shared.module";

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import 'hammerjs';
import { AppRoutingModule } from "../app.routing.module";
import { config } from '../config/config';
@NgModule({
  imports: [
    HttpModule,
    SharedModule,
    BrowserAnimationsModule,
    AppRoutingModule,
    ServicesModule.forRoot()

  ],
  exports: [
    HeaderComponent,
    FooterComponent,
    SidebarComponent,
    AppRoutingModule,


  ],
  declarations: [
    HeaderComponent,
    FooterComponent,
    SidebarComponent,
  ],
  providers: [config]
})
export class CoreModule {
  constructor(ir: MatIconRegistry, ds: DomSanitizer,
    @Optional() @SkipSelf() parent: CoreModule) {
    if (parent) {
      throw new Error('模块已存在！');
    };
    // 全局装载icon
    loadSvgRegsources(ir, ds);
  }
 }
